package com.zhuiYun.project.api.newDaily.controller;

import com.zhuiYun.project.api.newDaily.entity.UserIntegral;
import com.zhuiYun.project.api.newDaily.model.UserCouponModel;
import com.zhuiYun.project.api.newDaily.service.NewDailyService;
import com.zhuiYun.project.common.controller.BaseController;
import com.zhuiYun.project.common.response.CommonResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO 每日上新（小程序）
 * @ClassName NewDaily
 * @Author HH
 * @Date 2023/4/5 13:46
 **/
@RestController
@RequestMapping("/newDaily")
public class NewDailyController extends BaseController {

    @Autowired
    NewDailyService newDailyService;

    /**
     * @Description 查询轮播图
     * @Author HH
     * @Date 2023/4/5 14:48
     * @Return com.zhuiYun.project.common.response.CommonResult

     */
    @ApiOperation(value = "查询首页轮播图")
    @GetMapping("/selectSlideShow")
    public CommonResult selectSlideShow(){
        return newDailyService.selectSlideShow();
    }

    /**
     * @Description 查询今日上新
     * @Author HH
     * @Date 2023/4/5 14:34
     * @Return com.zhuiYun.project.common.response.CommonResult

     */
    @ApiOperation(value = "查询今日上新")
    @GetMapping("/selectCommodityNew")
    public CommonResult selectCommodityNew(){
        return newDailyService.selectCommodityNew();
    }

    /**
     * @Description 查询拼团好货
     * @Author HH
     * @Date 2023/4/5 14:34
     * @Return com.zhuiYun.project.common.response.CommonResult

     */
    @ApiOperation(value = "查询拼团好货")
    @GetMapping("/selectCommodity")
    public CommonResult selectCommodity(){
        return newDailyService.selectCommodity();
    }

    /**
     * @Description 根据用户id查询用户可用的优惠券
     * @Author HH
     * @Date 2023/4/6 21:24
     * @Return com.zhuiYun.project.common.response.CommonResult
     * @param userId
     */
    @ApiOperation(value = "查询用户可用的优惠券")
    @GetMapping("/selectUserCoupon")
    public CommonResult selectUserCoupon(Integer userId){
        return newDailyService.selectUserCoupon(userId);
    }

    /**
     * @Description 添加用户优惠券
     * @Author HH
     * @Date 2023/4/7 9:53
     * @Return int
     * @param userCouponModel
     */
    @ApiOperation(value = "添加用户优惠券")
    @PostMapping("/insertUserCoupon")
    public CommonResult insertUserCoupon(@RequestBody UserCouponModel userCouponModel){
        return newDailyService.insertUserCoupon(userCouponModel);
    }


    /**
     * @Description 查询用户积分
     * @Author HH
     * @Date 2023/4/13 16:21
     * @Return com.zhuiYun.project.common.response.CommonResult
     * @param userId
     */
    @GetMapping("/selectUserIntegral")
    public CommonResult selectUserIntegral(Integer userId){
        return newDailyService.selectUserIntegral(userId);
    }

    /**
     * @Description 查询用户今天是否签到
     * @Author HH
     * @Date 2023/4/13 19:42
     * @Return com.zhuiYun.project.common.response.CommonResult
     * @param userId
     */
    @GetMapping("/selectSignInState")
    public CommonResult selectSignInState(Integer userId) {
        return newDailyService.selectSignInState(userId);
    }

    /**
     * @Description 用户签到
     * @Author HH
     * @Date 2023/4/13 16:24
     * @Return com.zhuiYun.project.common.response.CommonResult
     * @param userIntegral
     */
    @ApiOperation(value = "用户签到")
    @GetMapping("/signIn")
    public CommonResult signIn(UserIntegral userIntegral){
        return newDailyService.signIn(userIntegral);
    }
}
